package com.datamation.swadeshi.adapter;

import java.util.ArrayList;

import com.datamation.swadeshi.R;
import com.datamation.swadeshi.control.data.DebtorDS;
import com.datamation.swadeshi.control.data.RouteDS;
import com.datamation.swadeshi.model.FDamHed;
import com.datamation.swadeshi.model.FTranHed;
import com.datamation.swadeshi.model.OrdHed;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class DamageHistoryAdapter extends ArrayAdapter<FDamHed> {
	Context context;
	ArrayList<FDamHed> list;
	
	public DamageHistoryAdapter(Context context, ArrayList<FDamHed> list) {
		super(context, R.layout.row_invoice_history, list);
		this.context = context;
		this.list = list;
		// TODO Auto-generated constructor stub
	}
	@Override
	public View getView(final int position, final View convertView, final ViewGroup parent) {
		
		LayoutInflater inflater = null;
		View row = null;
		
		inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		row = inflater.inflate(R.layout.row_invoice_history, parent, false);
		
		TextView refno = (TextView) row.findViewById(R.id.refno);
		TextView date = (TextView) row.findViewById(R.id.date);
		TextView route = (TextView) row.findViewById(R.id.route);
		TextView amount = (TextView) row.findViewById(R.id.amount);
		TextView customer=(TextView) row.findViewById(R.id.customer);
		
		RouteDS routeDS=new RouteDS(context);
		DebtorDS debtorDS =new DebtorDS(context);
		refno.setText(list.get(position).getFDAMHED_REFNO());
		date.setText(list.get(position).getFDAMHED_TXNDATE());
		route.setText("");
		amount.setText(list.get(position).getFDAMHED_TOTALAMT());
		customer.setText(list.get(position).getFDAMHED_LOCTO());
		
		return row;
	}

}
